<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>订单详情--${site.name}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="description" content="${site.description}" />
<meta name="keywords" content="${site.keywords}" />
<meta name="author" content="${site.author}" />
<link rel="icon" href="${site.logo}">
<link rel="stylesheet" href="${base}/static/layui/css/layui.css"
	media="all" />
<style>
.layui-card-header {
	font-weight: bold;
}
</style>
</head>
<body class="childrenBody">
	<div class="layui-card">
		<div class="layui-card-header">订单信息</div>
		<div class="layui-card-body layui-text">
			<div class="layui-row">
				<div class="layui-col-sm4">订单号：${order.orderno}</div>
				<div class="layui-col-sm4">订单状态：${order.exts.orderStatusStr}</div>
			</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-sm4">下单时间：${order.createTime?string('yyyy-MM-dd
					HH:mm')}</div>
				<div class="layui-col-sm4">商品总数量：${order.pcount}</div>
				<div class="layui-col-sm4">支付方式：${order.payWay!'-'}</div>
			</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-sm4">实付款：￥${order.priceReal}</div>
				<div class="layui-col-sm4">商品总金额：￥${order.priceTotal}</div>
				<div class="layui-col-sm4">运费：￥0</div>
			</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-sm12">用户备注：${order.remark!'-'}</div>
			</div>
		</div>
	</div>

	<div class="layui-card">
		<div class="layui-card-header">购买的商品信息</div>
		<div class="layui-card-body layui-text">
			<table class="layui-table">
				<thead>
					<th>商品</>
					<th>规格</>
					<th>数量</>
					<th>价格</>
				</thead>
				<tbody>
					<#list order.details as item>
					<tr>
						<td><img
							style="width: 50px; height: 50px; margin-right: 15px;"
							src="${item.img}" />${item.name}</td>
						<td>${item.attrName}</td>
						<td>${item.num}</td>
						<td>￥${item.price}</td>
					</tr>
					</#list>
				</tbody>
			</table>
		</div>
	</div>

	<div class="layui-card">
		<div class="layui-card-header">收货信息</div>
		<div class="layui-card-body layui-text">
			<div class="layui-row">
				<div class="layui-col-sm4">收货人：${order.express.username}</div>
				<div class="layui-col-sm4">联系电话：${order.express.phone}</div>
				<div class="layui-col-sm4">收货地址：${order.express.detail}</div>
			</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-sm4">物流公司：${order.express.companyNo!'-'}</div>
				<div class="layui-col-sm4">物流编码：${order.express.expressNo!'-'}</div>
			</div>
		</div>
	</div>

	<div class="layui-card">
		<div class="layui-card-header">订单轨迹</div>
		<div class="layui-card-body layui-text">
			<#list order.records as item>
			<div>
				${item.opTime?string('yyyy-MM-dd HH:mm')} <span></span>
				${item.content}
			</div>
			</#list>
		</div>
	</div>


	<div class="layui-form-item" style="margin-top: 30px;">
		<div class="layui-input-block">
			<#if order.status==19 || order.status==20>
			<button class="layui-btn" id="send">发货</button>
			</#if>
			<button class="layui-btn layui-btn-primary"
				onclick="parent.layer.close(parent.layer.getFrameIndex(window.name)); ">关闭</button>
		</div>
	</div>

	<script type="text/javascript" src="${base}/static/layui/layui.js"></script>
	<script>
		layui.use([ 'form', 'jquery', 'layer' ], function() {
			var form = layui.form, $ = layui.jquery;

			$('#send').click(function() {
				layer.open({
					type : 1,
					title:'发货',
					area:['50%','300px'],
					content : $('#sendDiv')
				//这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
				});
			});
			
			form.on("submit(addExpressInfo)",function(data){

	            var loadIndex = layer.load(2, {
	                shade: [0.3, '#333']
	            });
	            data.field.orderno = '${order.orderno}';
	            $.post("${base}${adminPrefix}/mall-order/send",data.field,function(res){
	                layer.close(loadIndex);
	                if(res.success){
	                    parent.layer.msg("发货成功！",{time:1000},function(){
	                        parent.layer.close(parent.addIndex);
	                        //刷新父页面
	                        parent.location.reload();
	                    });
	                }else{
	                    layer.msg(res.message);
	                }
	            });
	            return false;
	        });

		});
	</script>
</body>
<!--发货框-->
<div id="sendDiv" style="display:none;padding:15px;">
	<form class="layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label"> <span class="required">*</span>
				物流公司名称
			</label>
			<div class="layui-input-block">

				<input type="text" class="layui-input" name="companyNo"
					autocomplete="companyNo" lay-verify="required"
					placeholder="请输入物流公司名称">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"> <span class="required">*</span>
				物流编号
			</label>
			<div class="layui-input-block">

				<input type="text" class="layui-input" name="expressNo"
					lay-verify="required" placeholder="请输入物流编号">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="addExpressInfo">立即提交</button>
			</div>
		</div>
	</form>
</div>
</html>